package com.forum.controller;


import com.forum.pojo.ForumArticle;
import com.forum.result.Result;
import com.forum.service.ForumArticleService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/select")
@CrossOrigin
public class SelectController {
    @Autowired
    ForumArticleService forumArticleService;
    @ApiOperation(value = "通过标题搜索帖子并分页")
    @GetMapping("/selectBoardEssay")
    public Result selectBoardEssay(@RequestParam String title,@RequestParam(required = false) String tag,@RequestParam Integer findType,@RequestParam Long pageNum,@RequestParam Long pageSize,@RequestParam Integer pBoardId){
        return forumArticleService.selectBoardEssay(title,tag,findType,pageNum,pageSize,pBoardId);
    }
    @ApiOperation("查询用户")
    @GetMapping("/selectPerson")
    public Result selectPerson(@RequestParam String nickName){
        return Result.ok(forumArticleService.selectPerson(nickName));
    }
}
